﻿using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;

namespace Himp.TaskScheduling.V1
{
    [Area(TaskSchedulingRemoteServiceConsts.ModuleName)]
    [RemoteService(Name = TaskSchedulingRemoteServiceConsts.RemoteServiceName)]
    [Route("api/taskScheduling/paramConfig")]
    [ApiVersion("1.0")]
    [ApiController]
    [ControllerName("paramConfig")]
    public class ParamConfigController : TaskSchedulingController, IParamConfigService
    {
        private IParamConfigService _paramConfigService;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="paramConfigService"></param>
        public ParamConfigController(IParamConfigService paramConfigService)
        {
            _paramConfigService = paramConfigService;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ParamConfigDto> CreateAsync([FromBody] ParamConfigCreateOrUpdateDto input)
        {
            return await _paramConfigService.CreateAsync(input);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task DeleteAsync(long id)
        {
            await _paramConfigService.DeleteAsync(id);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ParamConfigDto> GetAsync(long id)
        {
            return await _paramConfigService.GetAsync(id);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("list")]
        public async Task<PagedResultDto<ParamConfigDto>> GetListAsync([FromQuery] ParamConfigInput input)
        {
            return await _paramConfigService.GetListAsync(input);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        [Route("{id}")]
        public async Task<ParamConfigDto> UpdateAsync(long id, [FromBody] ParamConfigCreateOrUpdateDto input)
        {
            return await _paramConfigService.UpdateAsync(id, input);
        }
    }
}
